const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
  entry: './app.js',
  mode: 'development',
  devtool: 'source-map',
  // devtool: 'inline-source-map',
  // devtool: 'hidden-source-map',
  // devtool: 'eval-source-map',
  // devtool: 'cheap-source-map',

  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist'),
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './index.html',
      title: 'index',
      filename: 'index.html',
    })
  ],
  module: {
      rules: [{
          test: /\.css$/,
          use: [
              // style-loader：创建style标签，将js中的样式资源插入进去，添加到head中生效
              'style-loader',
              // css-loader：将css文件变成commonjs模块加载到js中，里面内容是样式字符串
              'css-loader'
          ]
      }]
  }
};
